/* === S T A R T =========================================================== */

#ifndef __SYNFIG_APP_UIMANAGER_H
#define __SYNFIG_APP_UIMANAGER_H

/* === H E A D E R S ======================================================= */

#include <ETL/handle>
#include <synfig/general.h>
#include <synfig/string.h>
#include <sigc++/object.h>

/* === M A C R O S ========================================================= */

/* === T Y P E D E F S ===================================================== */

/* === C L A S S E S & S T R U C T S ======================================= */

namespace synfigapp {

class UIInterface : public etl::shared_object, public synfig::ProgressCallback, public sigc::trackable
{
public:
	enum Response
	{
		RESPONSE_CANCEL=-1,
		RESPONSE_NO=0,
		RESPONSE_YES=1,
		RESPONSE_OK=2
	};
	virtual ~UIInterface() { }
	virtual Response yes_no(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES)=0;
	virtual Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES)=0;
	virtual Response ok_cancel(const std::string &title, const std::string &message,Response dflt=RESPONSE_OK)=0;
};

class DefaultUIInterface : public UIInterface
{
public:
	Response yes_no(const std::string &/*title*/, const std::string &/*message*/,Response dflt)
		{ return dflt; }
	Response yes_no_cancel(const std::string &/*title*/, const std::string &/*message*/,Response dflt)
		{ return dflt; }
	Response ok_cancel(const std::string &/*title*/, const std::string &/*message*/,Response dflt)
		{ return dflt; }

	bool task(const std::string &/*task*/)
		{ return true; }
	bool error(const std::string &/*task*/)
		{ return true; }
	bool warning(const std::string &/*task*/)
		{ return true; }
	bool amount_complete(int /*current*/, int /*total*/)
		{ return true; }
};

class ConfidentUIInterface : public UIInterface
{
public:
	Response yes_no(const std::string &/*title*/, const std::string &/*message*/,Response /*dflt*/)
		{ return RESPONSE_YES; }
	Response yes_no_cancel(const std::string &/*title*/, const std::string &/*message*/,Response /*dflt*/)
		{ return RESPONSE_YES; }
	Response ok_cancel(const std::string &/*title*/, const std::string &/*message*/,Response /*dflt*/)
		{ return RESPONSE_OK; }

	bool task(const std::string &/*task*/)
		{ return true; }
	bool error(const std::string &/*task*/)
		{ return true; }
	bool warning(const std::string &/*task*/)
		{ return true; }
	bool amount_complete(int /*current*/, int /*total*/)
		{ return true; }
};

class ConsoleUIInterface : public UIInterface
{
public:
	Response yes_no(const std::string &title, const std::string &message,Response dflt);
	Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt);
	Response ok_cancel(const std::string &title, const std::string &message,Response dflt);

	bool task(const std::string &task);
	bool error(const std::string &task);
	bool warning(const std::string &task);
	bool amount_complete(int current, int total);
};

}; // END of namespace synfigapp

/* === E N D =============================================================== */

#endif
